import func from '@/utils/func';
import dict from '@/const/dict/dict';

export default {
  height: 'auto',
  calcHeight: 30,
  menuType: 'menu',
  tip: false,
  searchShow: true,
  border: true,
  index: true,
  viewBtn: true,
  selection: true,
  dialogClickModal: false,
  grid: false,
  gridBtn: false,
  dialogDrag: true,
  defaultSort: {
    prop: 'sorting',
    order: 'ascending'
  },
  column: [
    {
      label: '主键',
      prop: 'id',
      type: 'input',
      addDisplay: false,
      editDisplay: false,
      viewDisplay: false,
      hide: true
    },
    {
      label: '平台名称',
      prop: 'platform',
      type: 'input',
      rules: [{
        required: true,
        message: '请输入平台名称',
        trigger: 'blur'
      }]
    },
    {
      label: '网站',
      prop: 'website',
      type: 'input',
      showOverflowTooltip: true
    },
    {
      label: 'API秘钥',
      prop: 'apiKey',
      type: 'input',
      showOverflowTooltip: true,
      span: 24
    },
    {
      label: '余额/流量',
      prop: 'info',
      type: 'input',
      display: false,
    },
    {
      label: '排序',
      prop: 'sorting',
      type: 'number',
      controls: false,
      sortable: 'custom'
    },
    {
      label: '信息API',
      prop: 'infoApi',
      component: 'code-editor',
      row: true,
      span: 24,
      hide: true,
    },
    {
      label: '查看白名单API',
      prop: 'viewWhitelistApi',
      component: 'code-editor',
      row: true,
      span: 24,
      hide: true,
    },
    {
      label: '添加白名单API',
      prop: 'addWhitelistApi',
      component: 'code-editor',
      row: true,
      span: 24,
      hide: true,
    },
    {
      label: '删除白名单API',
      prop: 'delWhitelistApi',
      component: 'code-editor',
      row: true,
      span: 24,
      hide: true,
    },
    {
      label: '创建时间',
      prop: 'createTime',
      type: 'datetime',
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      startPlaceholder: '开始日期',
      endPlaceholder: '结束日期',
      display: false
    },
    {
      label: '状态',
      prop: 'status',
      type: 'switch',
      dicData: dict.enable_disable,
      dataType: 'number',
      value: 1,
      search: true,
      searchSpan: 4,
      searchLabelWidth: 75,
      rules: [{
        required: true,
        message: '请输入状态',
        trigger: 'blur'
      }]
    }
  ]
};
